﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AxeFrog.Data
{
	public interface IFieldAttribute
	{
		int? OrderByRank { get; }
		bool Descending { get; }
	}

	[AttributeUsage(AttributeTargets.Property, AllowMultiple=false, Inherited=true)]
	public class FieldAttribute : Attribute, IFieldAttribute
	{
		public FieldAttribute()
		{
		}

		public FieldAttribute(int orderByRank)
		{
			_orderByRank = orderByRank;
		}

		public FieldAttribute(int orderByRank, bool descending)
		{
			_orderByRank = orderByRank;
			_descending = descending;
		}

		private int? _orderByRank;
		public int? OrderByRank { get { return _orderByRank; } }

		private bool _descending;
		public bool Descending
		{
			get { return _descending; }
		}
	}

	[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
	public class IdentityFieldAttribute : Attribute, IFieldAttribute
	{
		public IdentityFieldAttribute()
		{
		}

		public IdentityFieldAttribute(int orderByRank)
		{
			_orderByRank = orderByRank;
		}

		public IdentityFieldAttribute(int orderByRank, bool descending)
		{
			_orderByRank = orderByRank;
			_descending = descending;
		}

		private int? _orderByRank;
		public int? OrderByRank { get { return _orderByRank; } }

		private bool _descending;
		public bool Descending
		{
			get { return _descending; }
		}
	}
}
